package cn.com.bluemoon.daps.common.enums;

import cn.com.bluemoon.daps.common.mp.BaseBmEnum;
import cn.hutool.core.util.EnumUtil;

/**
 * 同步状态
 */
public enum SyncStatus implements BaseBmEnum<Integer> {
    /**
     * 同步状态
     */
    SYNC_WAIT("未同步", 0),

    SYNC_DOING("同步中", 1),

    SYNC_DONE("已同步", 2),

    SYNC_ERROR("同步失败", 3),

    /**
     * 增加后端交互ALL
     */
    SYNC_ALL("同步全部", 99);
    // 2021/6/30 沙箱环境同步中
//    SYNC_SANDBOX_DOING("沙箱同步中", -1);


    private final String desc;
    private final Integer code;


    SyncStatus(String desc, Integer code) {
        this.desc = desc;
        this.code = code;
    }

    public static SyncStatus valOf(Integer code) {
        return EnumUtil.likeValueOf(SyncStatus.class, code);
    }

    public String getDesc() {
        return desc;
    }

    public Integer getCode() {
        return code;
    }

    @Override
    public String toString() {
        return desc;
    }

    /**
     * 枚举数据库存储值
     */
    @Override
    public Integer getValue() {
        return this.code;
    }
}
